home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / libg++ / src / gen / FPStack.hP < prev    next >
Text File  |  1992-04-14  |  2KB  |  115 lines

  1. // This may look like C code, but it is really -*- C++ -*-
  2. /* 
  3. Copyright (C) 1988 Free Software Foundation
  4.     written by Doug Lea (dl@rocky.oswego.edu)
  5.     based on code by Marc Shapiro (shapiro@sor.inria.fr)
  6.  
  7. This file is part of the GNU C++ Library.  This library is free
  8. software; you can redistribute it and/or modify it under the terms of
  9. the GNU Library General Public License as published by the Free
  10. Software Foundation; either version 2 of the License, or (at your
  11. option) any later version.  This library is distributed in the hope
  12. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  13. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  14. PURPOSE.  See the GNU Library General Public License for more details.
  15. You should have received a copy of the GNU Library General Public
  16. License along with this library; if not, write to the Free Software
  17. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20.  
  21. #ifndef _<T>FPStack_h
  22. #ifdef __GNUG__
  23. #pragma interface
  24. #endif
  25. #define _<T>FPStack_h
  26.  
  27. #include "<T>.FPlex.h"
  28. #include "<T>.Stack.h"
  29.  
  30. class <T>FPStack : public <T>Stack
  31. {
  32.   <T>FPlex      p;
  33.  
  34. public:
  35.                 <T>FPStack(int chunksize = DEFAULT_INITIAL_CAPACITY);
  36.                 <T>FPStack(const <T>FPStack& s);
  37.                 ~<T>FPStack();
  38.  
  39.   void          operator = (const <T>FPStack&);
  40.  
  41.   void          push(<T&> item);
  42.   <T>           pop();
  43.   <T>&          top();               
  44.   void          del_top();
  45.  
  46.   int           empty();
  47.   int           full();
  48.   int           length();
  49.  
  50.   void          clear();
  51.  
  52.   int           OK();
  53.  
  54. };
  55.  
  56.  
  57. inline <T>FPStack::<T>FPStack(int chunksize) : p(chunksize) {}
  58. inline <T>FPStack::<T>FPStack(const <T>FPStack& s) : p(s.p) {}
  59.  
  60. inline <T>FPStack::~<T>FPStack() {}
  61.  
  62. inline void <T>FPStack::push(<T&>item)
  63. {
  64.   p.add_high(item);
  65. }
  66.  
  67. inline <T> <T>FPStack::pop()
  68. {
  69.   <T> res = p.high_element();
  70.   p.del_high();
  71.   return res;
  72. }
  73.  
  74. inline <T>& <T>FPStack::top()
  75. {
  76.   return p.high_element();
  77. }
  78.  
  79. inline void <T>FPStack::del_top()
  80. {
  81.   p.del_high();
  82. }
  83.  
  84. inline void <T>FPStack::operator =(const <T>FPStack& s)
  85. {
  86.   p = s.p;
  87. }
  88.  
  89. inline int <T>FPStack::empty() 
  90. {
  91.   return p.empty();
  92. }
  93.  
  94. inline int <T>FPStack::full() 
  95. {
  96.   return p.full();
  97. }
  98.  
  99. inline int <T>FPStack::length() 
  100. {
  101.   return p.length();
  102. }
  103.  
  104. inline int <T>FPStack::OK() 
  105. {
  106.   return p.OK();
  107. }
  108.  
  109. inline void <T>FPStack::clear() 
  110. {
  111.   p.clear();
  112. }
  113.  
  114. #endif
  115.